package com.xiweicheng.test.proxy.resp.handler;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;

public class DefaultRespHandler extends RespHandler {

	@Override
	protected void handle(HttpURLConnection conn, HttpServletResponse resp) throws IOException {
		// 读取服务器端返回的内容
		InputStream is = conn.getInputStream();
		ServletOutputStream os = resp.getOutputStream();

		byte[] buffer = new byte[1024];
		int len = -1;
		while ((len = is.read(buffer)) != -1) {
			os.write(buffer, 0, len);
		}
	}

}
